package com.bid.base.common.query;

/**
 * 
 * @author Administrator
 *
 */
public class QueryBase {
	
	//每页记录条数 defaultPageSize=10;
	private int pageSize;
	
	//页码 从第1页开始，
	private int pageIndex;

	private Object data;
	
	public int defaultPageSize=6;
	
	public int maxPageSize=15;
	//startRow endRow
	public int getStartRow() {
		return ((getPageIndex())-1)*(getPageSize());
	}
	
	public int getEndRow() {
		return (getPageIndex())*((getPageSize()));
	}
	
	
	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}
	
	/**
	 * pagesize = pagesize == null? "10": pagesize;
		pageindex = pageindex == null ? "1" : pageindex;
	 */
	public int getPageSize() {
		if(pageSize <=0){
			return defaultPageSize;
		}
		if(pageSize >maxPageSize){
			return defaultPageSize;
		}
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getPageIndex() {
		return pageIndex <=0  ? 1 : pageIndex;
	}

	public void setPageIndex(int pageIndex) {
		this.pageIndex = pageIndex;
	}
}
